package models

import (
	"github.com/astaxie/beego/orm"
	_"github.com/go-sql-driver/mysql"
)
//与表的设计有关的内容
type User struct {
	Id int
	Name string
	Pwd string
}
//增删改查在控制器里面
func  init()  {

	err := orm.RegisterDataBase("default","we_go","root:111111@tcp(127.0.0.1:3306)/test?charset=utf8")
	if err != nil {
		return 
	}
	orm.RegisterModel(new(User))
	//生成表
	err2 := orm.RunSyncdb("default",false,true)
	if err2 != nil {
		return
	}
}